<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('下级已办毕T')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="workFormNo"/>
                        </li>
                        <li>
                            承办部门：<input type="text" name="sbDeptName"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
<!--            <a class="btn btn-success multiple disabled" onclick="check()">-->
<!--                <i class="fa fa-info"></i> 查看-->
<!--            </a>-->
            <a class="btn btn-success multiple disabled" onclick="sendBackManage()">
                <i class="fa"></i> 派单管理
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/common/js/common.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "gaoxin/system/mTelWF";

    $(function () {
        var options = {
            url: prefix + "/rCity/listSonOverUntreatedJson",
            sortName: "myPkVal",
            sortOrder: "desc",
            uniqueId: "myPkVal",
            updateUrl: prefix + "/rCity/sendBackChk/{id}",
            modalName: "下级已办毕工单",
            fixedColumns: true,
            fixedNumber: 1,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                {field: 'ck', checkbox: true, title: '&nbsp;', visible: false},
                {field: 'myPkVal', title: 'pkid', hidden: true, visible: false},
                {field: 'twfpk', title: 'twfpk', hidden: true, visible: false},
                {field: 'telpk', title: 'telpk', hidden: true, visible: false},
                {field: 'fDNo', title: 'fDNo', hidden: true, visible: false},
                {field:'pid',title:'pid',visible:false},
                {field: 'myTwfNO', title: '工单编号', align: 'left', halign: 'center', sortable: true,formatter:function(value,row,index){return fmtScanByNO(value,row,index);}},
                {field: 'myTwfTopic', title: '工单主题', align: 'left', halign: 'center'},
                {field: 'FmContent', title: '工单内容', align: 'center',formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis},
                {field: 'SBDeptName', title: '承办部门', align: 'left', halign: 'center', sortable: true},
                {field: 'SeqName', title: '交办次序', align: 'center'},
                {field: 'SortName', title: '性质', align: 'center', sortable: true, visible: false},
                {field: 'BackLimit', title: '办理期限', align: 'center', sortable: true,formatter : function(value,row,index){return interceptDate(value,row,index);}},
                {field: 'SendRemark', title: '派发备注', align: 'left', halign: 'center'},
                {
                    field: 'SendState',
                    title: '签收情况',
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return fmtSBSendState(value, row, index);
                    }
                },
                {
                    field: 'BackState',
                    title: '回复情况',
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return fmtSBBackState(value, row, index);
                    }
                },
                {
                    field: 'chgChk', title: '审查情况', align: 'center', formatter: function (value, row, index) {
                        return fmtSBBackCheck(value, row, index);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.handleTab(\'' + row.myPkVal + '\')"><i class="fa fa-edit"></i>审查</a> ');
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="examine(\'' + row.myPkVal + '\')"><i class="fa fa-edit"></i>审查</a> ');
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="OnQxListShowWin(\'' + row.twfpk + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function OnQxListShowWin(idWF) {
        var url = 'gaoxin/system/test/caseDetail/' + idWF;
        parent.$.modal.openTab('电话工单-详情',url);
    }

    function fmtScanByNO(value,row,index){
        return '<a href="javascript:void(0);" onclick="OnQxListShowWin('+row.twfpk+')" title="单击查看详情" class="lstWd">'+value+'</a>';;
    }

    function sendBackManage() {
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        let pid=row[0].pid==null?0:row[0].pid;
        var url = prefix + "/rCity/sendBackList?wfId=" + row[0].twfpk + "&telId=" + row[0].telpk+"&pid="+pid;
        var width = '80%';
        var height = '80%';
        var title = '派单管理';
        $.modal.openDialog(title, url, width, height);
    }

    function check() {
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        let wfId = row[0].twfpk;
        let pkId = row[0].myPkVal;
        var url = prefix + '/rCity/sendDeptEdit/' + wfId + '/' + pkId;
        var width = '70%';
        var height = '75%';
        var title = '查看-派单';
        var config = {
            title: title,
            width: width,
            height: height,
            url: url,
            btn: ['关闭'],
            skin: 'layui-layer-gray',
            yes: function (index, layero) {
                $.modal.close(index);
            }
        };
        $.modal.openOptions(config);
    }

    function examine(id){
        var url = 'gaoxin/system/mTelWF/rCity/sendBackChk/' + id;
        parent.$.modal.openTab('处理下级已办毕工单',url);
    }
</script>
</body>
</html>